-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
http2: improve errors thrown in header validation #16718
Conversation
@@ -837,7 +837,7 @@ requests and responses. | |||
<a id="ERR_HTTP2_INVALID_HEADER_VALUE"></a> | |||
### ERR_HTTP2_INVALID_HEADER_VALUE | |||
|
|||
Used to indicate that an invalid HTTP/2 header value has been specified. | |||
Used to indicate that an invalid HTTP2 header value has been specified. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh, accidental...can be fixed later.
err = new errors.TypeError('ERR_HTTP2_INVALID_HEADER_VALUE', value, name); | ||
} | ||
if (err !== undefined) { | ||
Error.captureStackTrace(err, assertValidHeader); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a particular reason to remove assertValidHeader
from the stack trace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lpinca I don't think that frame adds more value to the stacktrace because you can easily tell which line it would be by the error thrown, and the error codes themselves are clear enough to show the reason. Adding one more frame just expose more internal details that the user should not worry about..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because you can easily tell which line it would be by the error thrown
Yes, but it should be inferred and it requires a little more effort. Internal details are useful for everyone when debugging. Anyway no problem, I can live with it :)
PR-URL: #16718 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Landed in 11a9f36, thanks! |
PR-URL: nodejs#16718 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: #16718 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Notable Changes: - **console**: - avoid adding infinite error listeners (Matteo Collina) [#16770](https://github.com/nodejs/n de/pull/16770) - **http2**: - improve errors thrown in header validation (Joyee Cheung) [#16718](https://github.com/nodej s/node/pull/16718) PR-URL: #17204
Notable Changes: - **console**: - avoid adding infinite error listeners (Matteo Collina) [#16770](https://github.com/nodejs/n de/pull/16770) - **http2**: - improve errors thrown in header validation (Joyee Cheung) [#16718](https://github.com/nodej s/node/pull/16718) PR-URL: #17204
Previously #16715
This PR:
ERR_HTTP2_INVALID_HEADER_VALUE
for debug-ability as [REQUEST] Better Errors in http validate headers #16714 suggests. Before it'sValue must not be undefined or null
, after it'sInvalid value "undefined" for header "test"
. If the user is setting the header in a loop this would be much more useful.Error.captureStackTrace
to exclude the validation functions from the stack traceChecklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
http2